﻿using WebHome_API.Models.DBModels;

namespace WebHome_API.Models.DataModels
{
    public class NovelList
    {
        public List<Novel_Table> Data { get; set; }

        public PageBase<Novel_Table> Page { get; set; }


        public NovelList(List<Novel_Table> list, int page, int perPage, MyContext context)
        {
            var url = context.OtherEnums.FirstOrDefault(u => u.ID == 1).Text;

            var cur = list.Skip((page - 1) * perPage).Take(perPage).ToList();
            for (int i = 0; i < cur.Count; i++)
            {
                cur[i].BackImage = url;
            }
            this.Page = new(list, page, perPage);
            this.Data = cur;
        }
    }
}
